//
//  SC_TextFeild.m
//  BOSS-SOOC
//
//  Created by apple on 16/8/29.
//  Copyright © 2016年 Gcx. All rights reserved.
//
#define SCALE0000 0.383
#import "SCUIToolHeader.h"


#import "SC_TextFeild.h"

@implementation SC_TextFeild
-(instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        [self createUI];
    }
    
    return self;
    
}
-(void)createUI{
    self.selected = NO;
    self.clearButtonMode = UITextFieldViewModeWhileEditing;
    CGRect frame = [self frame];
    frame.size.width = 30*SCALE0000;
    UIView *leftview = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 30*SCALE0000, 96*SCALE0000)];
    self.leftViewMode = UITextFieldViewModeAlways;
    self.leftView = leftview;
    self.font = NormalFont(42);
    self.textColor = Color333333;
    [self addTarget:self action:@selector(textFieldDidChange:)forControlEvents:UIControlEventEditingChanged];
    
}

-(void)textFieldDidChange:(UITextField *)textfield{
    
    if (self.myBlock != NULL){
        self.myBlock(textfield.text);}
    
    if (textfield.text.length>=1) {
        self.selected = YES;
    }else{
        
        self.selected = NO;
        
    }
    
    
}

@end
